Skip to content

fix(uninstall): report the caches it does not remove - #175

Merged
rominf merged 1 commit into
mainfrom
fix/uninstall-reports-shared-caches
Aug 12, 2026
Merged

rominf merged 1 commit into
mainfrom
fix/uninstall-reports-shared-caches

Conversation

@rominf

@rominf rominf commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

rocm uninstall now names the caches it leaves behind, with their paths and why. Nothing new is deleted.

Please review:
  - the uv package cache is shared with other uv projects on this computer and is not removed: /home/<user>/.cache/uv
  - downloaded model files are slow to fetch again and may include your own, so they are not removed: /home/<user>/.cache/huggingface/hub

Root cause

build_uninstall_plan removes binaries plus the config, data, and cache directories. The two largest things an install causes to appear on disk are in neither:

  • The uv package cache — uv_command_env() never set UV_CACHE_DIR, so uv used its own default outside the ROCm CLI directories.
  • Downloaded model files — nothing in the product sets HF_HOME, so weights land in the shared default. hf_cache_roots_from only reads the environment for discovery.

A user who uninstalls to reclaim space can be left with tens of gigabytes still gone, with nothing in the output to suggest it.

Technical decisions

Report, don't delete. The uv cache is shared with every other uv project on the machine and ROCm CLI never claimed it; deleting it would slow down unrelated work. Model files are large, slow to re-fetch, sometimes gated behind a token, and may be the user's own. Naming them is what closes the honesty gap; deleting them is a separate decision.

Locations are resolved at run time from UV_CACHE_DIR, HF_HOME, and HUGGINGFACE_HUB_CACHE, falling back to the standard defaults — rather than assuming a fixed path.

Anything already inside a directory being removed is skipped, so a note is never printed for a cache that uninstall does in fact delete. This matters because #170 moves the uv cache under the data directory: once that lands, the uv note correctly stops appearing without further changes here, and it keeps working for users who point UV_CACHE_DIR elsewhere. The two PRs are independent and can land in either order.

Missing paths are not mentioned, so the output stays quiet on a machine that never populated them.

Tests

The filtering logic is split into a pure shared_cache_notes_for, so the three tests do not depend on the caller's real environment:

  • a cache inside a removed directory is not reported (the note would be false)
  • a cache outside everything being removed is reported, with its path
  • a missing path is not mentioned

CI note

cargo test --workspace shows two unrelated failures in proc_lifecycle — see #168, fixed by #169. Everything else passes; fmt and clippy -D warnings are clean.

Fixes #163

@rominf
rominf requested a review from a team as a code owner August 3, 2026 16:49

@juhovainio juhovainio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm @rominf , please check that we have e2e coverage for this as well

Uninstall presents itself as removing what ROCm CLI put on the machine,
but it only removes the config, data, and cache directories. The uv
package cache and the downloaded model files live outside all three and
are usually the largest things on disk after an install, so a plan that
stays silent about them reads as a clean slate it does not deliver.

List them under the existing 'Please review:' section with their paths
and why each is left alone. Nothing new is deleted.

Locations are resolved at run time from UV_CACHE_DIR, HF_HOME, and
HUGGINGFACE_HUB_CACHE, falling back to the standard defaults, and any
path already inside a directory being removed is skipped — so the notes
stay truthful as caches move under the data directory.

Closes #163

Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
@rominf
rominf force-pushed the fix/uninstall-reports-shared-caches branch from bbd7e0b to 1b35b3c Compare August 11, 2026 16:15
@rominf
rominf added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit 2f95760 Aug 12, 2026
23 checks passed
@rominf
rominf deleted the fix/uninstall-reports-shared-caches branch August 12, 2026 10:45
jgmelber added a commit to jgmelber/rocm-cli that referenced this pull request Aug 17, 2026
Follow-on to ROCm#170/ROCm#160: uv_command_env() colocated UV_CACHE_DIR with the
managed data dir but left UV_PYTHON_INSTALL_DIR unset, so `uv python install`
(invoked by ensure_managed_python) still fell back to uv's own default of
$HOME/.local/share/uv/python/, leaking a ~100MB standalone CPython interpreter
outside the managed root.

Mirrors ROCm#170's UvCacheSource design for the interpreter install dir:
UvPythonInstallDirSource with the same managed/override/inherited precedence, a
namespaced ROCM_CLI_UV_PYTHON_INSTALL_DIR escape hatch, a one-shot notice for
the legacy location, and updated uninstall help text.

Also extends the ROCm#175 uninstall reporting: now that the interpreters are the
other large thing rocm-cli causes to be downloaded, an overridden install dir
outside the data dir is reported as "not removed" rather than silently left
behind.

Signed-off-by: Joseph Melber <jmelber@amd.com>
jgmelber added a commit to jgmelber/rocm-cli that referenced this pull request Sep 9, 2026
Follow-on to ROCm#170/ROCm#160: uv_command_env() colocated UV_CACHE_DIR with the
managed data dir but left UV_PYTHON_INSTALL_DIR unset, so `uv python install`
(invoked by ensure_managed_python) still fell back to uv's own default of
$HOME/.local/share/uv/python/, leaking a ~100MB standalone CPython interpreter
outside the managed root.

Mirrors ROCm#170's UvCacheSource design for the interpreter install dir:
UvPythonInstallDirSource with the same managed/override/inherited precedence, a
namespaced ROCM_CLI_UV_PYTHON_INSTALL_DIR escape hatch, a one-shot notice for
the legacy location, and updated uninstall help text.

Also extends the ROCm#175 uninstall reporting: now that the interpreters are the
other large thing rocm-cli causes to be downloaded, an overridden install dir
outside the data dir is reported as "not removed" rather than silently left
behind.

Signed-off-by: Joseph Melber <jmelber@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: rocm uninstall leaves the uv cache and model weights behind

2 participants